package vl06.synchronisation;

class CentralCounter {
private volatile int counter ;
CentralCounter() {
counter = 0;
}
int increment() {
int startValue =  counter ;
expensiveCalculations(startValue);
// We finally have our result (really just ++)
counter = ++startValue;
return startValue;
}
private   int expensiveCalculations( int in) {
	return in;
// Lots of time-consuming calculations, as though we
// actually had something to do.
//...
}
}
